package com.example.demo.service.serviceimpl;

import com.example.demo.dao.ProductsDao;
import com.example.demo.entity.ProductsEntity;
import com.example.demo.service.ProductsService;
import com.example.demo.vo.ProductsVo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductsServiceImpl implements ProductsService {
    @Resource
    ProductsDao productsDao;
    
    @Override
    public ProductsEntity getProductById(int id) {
        return productsDao.getProductsId(id);
    }

    @Override
    public List<ProductsEntity> getAllProducts() {
        return productsDao.getProducts();
    }



    @Override
    public int addProduct(ProductsVo productsVo) {
        return productsDao.addProducts(productsVo);
    }

    @Override
    public int updateProduct(ProductsVo productsVo) {
        return productsDao.upProducts(productsVo);
    }

    @Override
    public int deleteProduct(int id) {
        return productsDao.delProducts(id);
    }
}
